<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"   
   xmlns:h="http://java.sun.com/jsf/html"
   xmlns:ui="http://java.sun.com/jsf/facelets"
   xmlns:f="http://java.sun.com/jsf/core"
   xmlns:ace="http://www.icefaces.org/icefaces/components"
   xmlns:icecore="http://www.icefaces.org/icefaces/core">
   <h:body> 
      <ui:composition template="/WEB-INF/templates/adminuser/template.xhtml">
         <ui:define name="content">
         
		<f:event type="preRenderView" listener="#{deviceInfoAdminBean.forwardDevicesIfNotSelection}"/>
         
              <h:form id="form-devicetype">
              
              		<icecore:singleSubmit />
              		
		            <ace:panel     closable  = "false"
			                       toggleable= "false"
			                       collapsed = "false" >
			       		<h:panelGrid  columns="3"  style="margin-left:auto; margin-right:auto;">
				            
				            <h:outputText   value="#{msgs['devicedata.name']}"/>
				            <h:inputText    id="name-value" required="true"  label="#{msgs['devicedata.namelabel']}" 
				                            value="#{deviceInfoAdminBean.selected.name}" /> 
	                        <h:message for="name-value" />
				            
				            <h:outputText   value="#{msgs['devicedata.type']}"/>
				            <h:selectOneMenu  id="type-value" required="true" requiredMessage="#{msgs['devicedata.typerequired']}" value="#{deviceInfoAdminBean.type}">
				                      <f:selectItem itemValue="#{null}" itemLabel="#{msgs['devicedata.selectype']}"/>
							          <f:selectItems value="#{deviceInfoAdminBean.deviceTypesMap}" />
						   	</h:selectOneMenu>
	                        <h:message for="type-value" /> 
				           
				            <h:outputText   value="#{msgs['devicedata.description']}"/>
				            <h:inputText   id="desc-value" required="true"   label="#{msgs['devicedata.desclabel']}"
				                           value="#{deviceInfoAdminBean.selected.description}" /> 
	                        <h:message for="desc-value" />
				            
				            <h:outputText   value="#{msgs['devicedata.soundingtime']}"/>
				            <h:inputText id="sound-value" label="#{msgs['devicedata.soundinglabel']}" 
				                         required="true"  value="#{deviceInfoAdminBean.selected.soundingTime}" >
	                                  <f:validateLongRange minimum="100" maximum="10000" />
	                        </h:inputText>
	                        <h:message for="sound-value" />  
				            
				            <h:outputText   value="#{msgs['devicedata.visible']}"/>
				            <h:selectBooleanCheckbox value="#{deviceInfoAdminBean.selected.visible}" />
				            <h:outputText   value=""/>
				             
				            <h:outputText   value="#{msgs['devicedata.IP']}"/>
				            <h:inputText  id="ip-value"  required="true"  value="#{deviceInfoAdminBean.selected.IP}" 
				                          validator="#{deviceInfoAdminBean.validateDNSname}" validatorMessage="#{msgs['devicedata.baddns']}"/>
	                        <h:message for="ip-value" />
                            
				            <h:outputText   value="#{msgs['devicedata.port']}"/>
				            <h:inputText    id = "port-value" required="true"  label="#{msgs['devicedata.portlabel']}" 
				                            value="#{deviceInfoAdminBean.selected.port}" >
	                                  <f:validateLongRange minimum="0" maximum="65535" />
	                        </h:inputText>
	                        <h:message for="port-value" /> 
	                        
				            <h:outputText   value="#{msgs['devicedata.unitID']}"/>
				            <h:inputText  id="unit-value" required="true"  label="#{msgs['devicedata.unitlabel']}"  
				                          value="#{deviceInfoAdminBean.selected.unitID}" >
	                                    <f:validateLongRange minimum="0" maximum="254" />
	                        </h:inputText>
	                        <h:message for="unit-value" /> 
	                        
				            <h:outputText   value="#{msgs['devicedata.autoconnection']}"/>
				            <h:selectBooleanCheckbox value="#{deviceInfoAdminBean.selected.autoConnection}" />
				            <h:outputText   value=""/>
				            
				        </h:panelGrid>
				        <h:commandButton  id="saveBttn" value="#{msgs['devicedata.saveChanges']}" 
	                                      actionListener="#{deviceInfoAdminBean.selected.saveChanges}"
	                                      action="devices" />
		            </ace:panel>
		            
	           </h:form>
	       </ui:define>		
      </ui:composition> 
   </h:body> 
</html>	